#-*- coding: utf-8 -*-
'''
Created on Aug 24, 2012

@author: bbg
'''

from sqlalchemy import Integer, Column, String, MetaData, Table
from sqlalchemy.orm import mapper

class Regions(object):
    '''
    使用这个系统的省级，城市基本信息
    '''

    def __init__(self):
        self.regionname = ''
        self.idfather = 0
        self.range = 0
        
    @staticmethod
    def doMapping():
        metaData = MetaData()
        regionsTable = Table('regions', metaData,
                           Column('region_id', Integer, primary_key = True),
                           Column('regionname', String),
                           Column('idfather', Integer),
                           Column('range', Integer),
                           schema="company_management")
        
        mapper(Regions, regionsTable)
        
    
# execute mapping
'''
默认做过mapper，后面使用不需要再进行mapper
'''
Regions.doMapping()
        